<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>json格式化及高亮</title>
    <meta name="description" content="json,格式化,高亮"/>
    <meta name="keywords" content="json,格式化,高亮"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="jsonFormater.css" type="text/css" rel="stylesheet"/>
    <link href="demo.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div style="width:auto;height: auto;background: antiquewhite;" id="mydiv">
    <button id="mytest" onclick="testurl()" type="button">是否安装app</button>
    <p id="myp"></p>
</div>
<script type="application/javascript">
    /*$(document).ready(function(){
        /!*alert("123");
        var text = $(document).text();
        if(str.indexOf("手机淘宝")>-1){
            alert('str中包含bc字符串');
        }*!/
        $("#mytest").blur(function () {
            alert("mybutton")
        });

    });*/

    /*window.alert = function(str) {
        var alertBox = document.createElement("div");
        alertBox.id="alertBox";
        alertBox.style.position = "absolute";
        alertBox.style.width = "400px";
        alertBox.style.background = "#F2F2F2";
        alertBox.style.border = "1px solid grey";
        alertBox.style.left = "50%";
        alertBox.style.top = "50%";
        alertBox.style.transform = "translate(-50%, -50%)";
        alertBox.style.textAlign = "center";
        alertBox.style.zIndex = "100";
        var strHtml = "";
        strHtml += '<div id="title">提示：<div id="close" onclick="certainFunc()"></div></div>';
        strHtml += '<div id="content">'+str+'</div>';
        strHtml += '<div id="certain"><input id="btn" type="button" value="确 定" onclick="certainFunc()" onhover="hoverFunc()"/></div>';
        alertBox.innerHTML = strHtml;
        document.body.appendChild(alertBox);
        var title = document.getElementById("title");
        title.style.textAlign = "left";
        title.style.marginTop = "20px";
        title.style.paddingLeft = "20px";
        title.style.height = "30px";
        title.style.fontSize = "15px";
        var close = document.getElementById("close");
        close.style.width = "16px";
        close.style.height = "16px";
        close.style.marginRight = "20px";
        close.style.background = "url('images/close.png')";
        close.style.float = "right";
        var content = document.getElementById("content");
        content.style.margin = "20px";
        content.style.fontSize = "12px";
        var certain = document.getElementById("certain");
        certain.style.position = "relative";
        certain.style.height = "50px";
        certainFunc = function() {
            alertBox.parentNode.removeChild(alertBox);
        };
        var btn = document.getElementById("btn");
        btn.style.width = "60px";
        btn.style.height = "30px";
        btn.style.background = "#cccccc";
        btn.style.border = "1px solid grey";
        btn.style.position = "absolute";
        btn.style.borderRadius = "5px";
        btn.style.right = "20px";
        btn.style.bottom = "20px";
        btn.style.marginTop = "10px";
        btn.style.cursor = "pointer";
        btn.style.color = "#333";
        hoverFunc = function() {
            btn.style.border = "1px blue solid";
        };
    }*/
    function testurl(){
        alert("测试");
        window.location.href = "taobao://login.m.taobao.com/qrcodeCheck.htm?lgToken=93e1ff07e6e7481dc3f9930086b22a57&tbScanOpenType=Notification";
        if(top.location!=self.location){
            document.getElementById("myp").innerHTML="不是顶层窗口";
        }else{
            document.getElementById("myp").innerHTML="是顶层窗口";
        }
    }
    /*window.onblur = function() {
        document.getElementById("myp").innerHTML="失去焦点";
        alert("失去焦点");
    }*/
    document.getElementById("mytest").blur(function () {
        document.getElementById("myp").innerHTML="button失去焦点";
    });



    window.onbeforeunload = function(event) {
        event.returnValue = "我在这写点东西...";
        alert("关闭中");
    };


</script>
</body>
</html>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>json格式化及高亮</title>
    <meta name="description" content="json,格式化,高亮"/>
    <meta name="keywords" content="json,格式化,高亮"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="jsonFormater.css" type="text/css" rel="stylesheet"/>
    <link href="demo.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div style="width:auto;height: auto;background: antiquewhite;" id="mydiv">
    <button id="mytest" onclick="testurl()" type="button">是否安装app</button>
    <p id="myp"></p>
</div>
<script type="application/javascript">
    /*$(document).ready(function(){
        /!*alert("123");
        var text = $(document).text();
        if(str.indexOf("手机淘宝")>-1){
            alert('str中包含bc字符串');
        }*!/
        $("#mytest").blur(function () {
            alert("mybutton")
        });

    });*/

    /*window.alert = function(str) {
        var alertBox = document.createElement("div");
        alertBox.id="alertBox";
        alertBox.style.position = "absolute";
        alertBox.style.width = "400px";
        alertBox.style.background = "#F2F2F2";
        alertBox.style.border = "1px solid grey";
        alertBox.style.left = "50%";
        alertBox.style.top = "50%";
        alertBox.style.transform = "translate(-50%, -50%)";
        alertBox.style.textAlign = "center";
        alertBox.style.zIndex = "100";
        var strHtml = "";
        strHtml += '<div id="title">提示：<div id="close" onclick="certainFunc()"></div></div>';
        strHtml += '<div id="content">'+str+'</div>';
        strHtml += '<div id="certain"><input id="btn" type="button" value="确 定" onclick="certainFunc()" onhover="hoverFunc()"/></div>';
        alertBox.innerHTML = strHtml;
        document.body.appendChild(alertBox);
        var title = document.getElementById("title");
        title.style.textAlign = "left";
        title.style.marginTop = "20px";
        title.style.paddingLeft = "20px";
        title.style.height = "30px";
        title.style.fontSize = "15px";
        var close = document.getElementById("close");
        close.style.width = "16px";
        close.style.height = "16px";
        close.style.marginRight = "20px";
        close.style.background = "url('images/close.png')";
        close.style.float = "right";
        var content = document.getElementById("content");
        content.style.margin = "20px";
        content.style.fontSize = "12px";
        var certain = document.getElementById("certain");
        certain.style.position = "relative";
        certain.style.height = "50px";
        certainFunc = function() {
            alertBox.parentNode.removeChild(alertBox);
        };
        var btn = document.getElementById("btn");
        btn.style.width = "60px";
        btn.style.height = "30px";
        btn.style.background = "#cccccc";
        btn.style.border = "1px solid grey";
        btn.style.position = "absolute";
        btn.style.borderRadius = "5px";
        btn.style.right = "20px";
        btn.style.bottom = "20px";
        btn.style.marginTop = "10px";
        btn.style.cursor = "pointer";
        btn.style.color = "#333";
        hoverFunc = function() {
            btn.style.border = "1px blue solid";
        };
    }*/
    function testurl(){
        //alert("测试");
        window.location.href = "taobao://login.m.taobao.com/qrcodeCheck.htm?lgToken=93e1ff07e6e7481dc3f9930086b22a57&tbScanOpenType=Notification";
    }
    window.onblur = function() {
        document.getElementById("myp").innerHTML="失去焦点";
        alert("失去焦点");
    }
    document.getElementById("mytest").blur(function () {
        document.getElementById("myp").innerHTML="button失去焦点";
    });



    window.onbeforeunload = function(event) {
        event.returnValue = "我在这写点东西...";
        alert("关闭中");
    };


</script>
</body>
</html>

